// pages/ad/index.js
const common = require('../../../public.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {

  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    const title = options.title
    if (title) {
      wx.setNavigationBarTitle({
        title
      })
    }
  },

  clickSave() {
    const benUrl = 'https://feiyangimage.oss-cn-shanghai.aliyuncs.com/wxApplets/ad/ad2.jpg'
    wx.getImageInfo({
      src: benUrl,
      success: function (res) {
        var path = res.path
        wx.saveImageToPhotosAlbum({
          filePath: path,
          success(res) {
            common.showToast('保存成功')
          }
        })
      }
    })
  }
})